/**
 * Created By zhangQ 2018/2/18
 * 产品需求模块
 */
import axiosUtils from '@api/env/axiosEnv'

let customAxios = axiosUtils._initAxios()

// 废弃
export function getProductDemandList (param) {
  return customAxios({
    url: '/productDemand/getProductDemandList',
    method: 'post',
    data: {
      product_type: param.productType,
      msg_type: param.msgType,
      local_city_id: param.local_city_id,
      need_city_id: param.need_city_id,
      page: param.page,
      pageSize: param.pageSize,
      isMine: param.isMine
    }
  })
}

/**
 * 查询所有货源
 * @param param
 * @returns {*}
 */
export function getProductDemandByPage (param) {
  return customAxios({
    url: '/productDemand/getProductDemandListByPage',
    method: 'post',
    data: param
  })
}

export function getCityList () {
  return customAxios({
    url: '/city/getCityList',
    method: 'post'
  })
}

export function addProductDemand (param) {
  return customAxios({
    url: '/main/productDemand/addProductDemand',
    method: 'post',
    data: {
      productType: param.productType,
      msgType: param.msgType,
      productName: param.productName,
      number: param.number,
      localCityId: param.localCityId,
      needCityId: param.needCityId,
      localCityDetail: param.localCityDetail,
      needCityDetail: param.needCityDetail,
      userName: param.userName,
      mobile: param.mobile,
      unit: param.unit
    }
  })
}

export function getProductDemandInfo (id) {
  return customAxios({
    url: '/main/productDemand/getProductDemandInfo',
    method: 'post',
    data: {
      id: id
    }
  })
}

export function deleteProductDemand (id) {
  return customAxios({
    url: '/main/productDemand/deleteProductDemand',
    method: 'post',
    data: {
      id: id
    }
  })
}

export function editProductDemand (param) {
  return customAxios({
    url: '/main/productDemand/editProductDemand',
    method: 'post',
    data: {
      id: param.id,
      productType: param.productType,
      msgType: param.msgType,
      productName: param.productName,
      number: param.number,
      localCityId: param.localCityId,
      localCityDetail: param.localCityDetail,
      needCityId: param.needCityId,
      userName: param.userName,
      needCityDetail: param.needCityDetail,
      mobile: param.mobile,
      unit: param.unit
    }
  })
}

// 查询招标公告 废弃
export function getBiddingList (param) {
  return customAxios({
    url: '/bidding/getAnnouncementList',
    method: 'post',
    data: {
      page: param.page,
      pageSize: param.pageSize,
      isMine: param.isMine,
      type: param.type,
      startTime: param.startTime,
      endTime: param.endTime
    }
  })
}

// 查询招标公告分页
export function getBiddingListByPage (param) {
  return customAxios({
    url: '/bidding/getAnnouncementListByPage',
    method: 'post',
    data: param
  })
}

export function addBidding (param) {
  return customAxios({
    url: '/main/bidding/addAnnouncement',
    method: 'post',
    data: {
      projectName: param.projectName,
      endTime: param.endTime,
      publicCompany: param.publicCompany,
      people: param.people,
      telephone: param.telephone,
      content: param.content,
      email: param.email,
      bulletinArea: param.bulletinArea,
      isMine: param.isMine
    }
  })
}

// 获取单个招标公告信息
export function getAnnouncementInfo (id) {
  return customAxios({
    url: '/bidding/getAnnouncementInfo',
    method: 'post',
    data: {
      id: id
    }
  })
}

// 编辑招标公告
export function editAnnouncement (param) {
  return customAxios({
    url: '/main/bidding/editAnnouncement',
    method: 'post',
    data: {
      id: param.id,
      projectName: param.projectName,
      endTime: param.endTime,
      publicCompany: param.publicCompany,
      people: param.people,
      telephone: param.telephone,
      content: param.content,
      email: param.email,
      bulletinArea: param.bulletinArea,
      isMine: param.isMine
    }
  })
}

// 招标公告删除
export function deleteAnnouncement (id) {
  return customAxios({
    url: '/main/bidding/deleteAnnouncement',
    method: 'post',
    data: {
      id: id
    }
  })
}
